﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PhotoHsn.WebApp.Tools.UserControls.DatePicker
{
    public partial class DTPicker : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(this.Page, typeof(string), this.ClientID + "1", "SetJqueryDateTime('" + txtBox.ClientID + "');", true);
            ////ScriptManager.RegisterStartupScript(this.Page, typeof(string), this.ClientID + "2", "SetJqueryDateTime('" + Image1.ClientID + "');", true);
            ////Image1.Attributes.Add("onclick", "javascript:HideMyValidation('" + txtBox.ClientID + "') ;return false;");
            //txtBox.Attributes.Add("onclick", "javascript:HideMyValidation('" + txtBox.ClientID + "') ;return false;");
            //txtBox.Attributes.Add("onchange", "javascript:HideMyValidation('" + txtBox.ClientID + "') ;return false;");
            ////txtBox.Attributes.Add("onclick", "javascript:HideMyValidation('" + txtBox.ClientID + "') ;  $.datepicker( \"show\" );return false;");

        }

        //public Unit Width
        //{
        //    get { return new Unit(tableOut.Width); }
        //    set
        //    {
        //        tableOut.Width = value.ToString();
        //    }
        //}

        public string TextValue
        {
            set { txtBox.Text = value; }
            get { return txtBox.Text; }
        }

        public bool IsNull
        {
            get { return string.IsNullOrEmpty(txtBox.Text); }
        }
        public DateTime DateValue
        {
            get { return Convert.ToDateTime(TextValue); }
        }
        //public bool IsRequired
        //{
        //    get { return txtBox.CssClass == "validate[required]"; }
        //    set
        //    {
        //        if (value)
        //            txtBox.CssClass = "validate[required]";
        //        else
        //            txtBox.CssClass = "";
        //    }
        //}
    }
}